@echo off
echo ========================================
echo Sentinel LDK 许可证管理系统测试脚本
echo ========================================
echo.

echo 1. 启动应用（后台运行）...
start /B gradlew bootRun

echo 等待应用启动...
timeout /t 10 /nobreak >nul

echo.
echo 2. 测试许可证验证接口...
curl -s http://localhost:8080/api/license/validate
echo.
echo.

echo 3. 测试许可证信息接口...
curl -s http://localhost:8080/api/license/info
echo.
echo.

echo 4. 测试创建用户（第1个用户）...
curl -s -X POST http://localhost:8080/api/license/users -H "Content-Type: application/json" -d "{\"username\":\"test1\",\"email\":\"test1@example.com\"}"
echo.
echo.

echo 5. 测试创建用户（第2个用户）...
curl -s -X POST http://localhost:8080/api/license/users -H "Content-Type: application/json" -d "{\"username\":\"test2\",\"email\":\"test2@example.com\"}"
echo.
echo.

echo 6. 查看用户列表...
curl -s http://localhost:8080/api/license/users
echo.
echo.

echo 7. 继续创建用户直到达到限制...
for /L %%i in (3,1,10) do (
    echo 创建用户 test%%i...
    curl -s -X POST http://localhost:8080/api/license/users -H "Content-Type: application/json" -d "{\"username\":\"test%%i\",\"email\":\"test%%i@example.com\"}"
    echo.
)

echo.
echo 8. 最终用户列表...
curl -s http://localhost:8080/api/license/users
echo.
echo.

echo ========================================
echo 测试完成！
echo 请检查上述输出，验证以下功能：
echo 1. 许可证验证是否成功
echo 2. 用户创建是否受到数量限制
echo 3. 超过限制时是否返回错误信息
echo ========================================
pause